//主从表tab选项卡标志位
var A40E3F_Tab_Flag = -1;
//选择某一行
var A40E3F_select_t_department_rowId = "";
//按钮事件新增或编辑
var A40E3F_type = "";
//其他页面传到本页面参数
var A40E3F_param = {};
//本页面传到其他页面参数
var A40E3F_toparam = {};
//table选中数据，如无则默认第一条
var A40E3F_rowCheckData = null;
//当前触发按钮
var A40E3F_btn = "";
//上一次触发的按钮
var A40E3F_prev_btn = "";
//树形节点选择
var A40E3F_select_TreeNode = {};
//表格数据服务端分页或客户端分页 1:服务端 0:客户端
var A40E3F_table_page = 1;

/*定义查询条件变量*/
/*declare query param begin*/
var A40E3F_tem_TreeNode = 0;

/*declare query param end*/

/*定义下拉框集合定义*/
/*declare select options begin*/
var A40E3F_ary_S_STATE = [{"MAIN_ID":"1","CN_NAME":"启用"},{"MAIN_ID":"0","CN_NAME":"禁用"}];

/*declare select options end*/

/*文件附件格式*/
/*input param fileinfo begin*/

/*input param fileinfo end*/

/*绑定show监听事件*/
if(A40E3F_Tab_Flag == -1){
	var A40E3F_n = Get_RandomDiv("A40E3F","");
	$(A40E3F_n).bind("show", function(objTag){
		A40E3F_Adjust_Sub_Sequ();
		if(!$(A40E3F_n).is(":hidden") && A40E3F_Tab_Flag > 0 && ("#"+objTag.currentTarget.id.toString()) == A40E3F_n)
			A40E3F_adjust_tab();		
	});
}

//设置主从表div顺序
function A40E3F_Adjust_Sub_Sequ(){
	var temSubDivs = $("#content-main").find("div[data-id]");
	var MainDiv = $(Get_RandomDiv("A40E3F",""));
	for(i = 0; i < temSubDivs.length; i++) {
		if(A40E3F_Is_Sub_Div(temSubDivs[i].id)){
			$(temSubDivs[i]).before($(MainDiv));
			break;
		}
	}
}

//主从表传递参数
function A40E3F_param_set(){
	/*Main Subsuv Table Param Begin*/
	
	/*Main Subsuv Table Param end*/
}

//业务逻辑数据开始
function A40E3F_t_department_biz_start(inputparam) {
	layer.close(ly_index);
	A40E3F_param = inputparam;
	//主从表传递参数
	A40E3F_param_set();	
    /*biz begin*/
    $.each(A40E3F_ary_S_STATE, function (i, obj) {
        addOptionValue("A40E3F_qry_S_STATE", obj[GetLowUpp("main_id")], s_decode(obj[GetLowUpp("cn_name")]));
    });
    A40E3F_init_t_department()
	
    /*biz end*/
}

/*业务函数步骤*/
/*biz step begin*/
function A40E3F_format_S_STATE(value, row, index) {
    var objResult = value;
    for(i = 0; i < A40E3F_ary_S_STATE.length; i++) {
        var obj = A40E3F_ary_S_STATE[i];
        if (obj[GetLowUpp("main_id")].toString() == value.toString()) {
            objResult = s_decode(obj[GetLowUpp("cn_name")]);
            break;
        }
    }
    return objResult;
}


/*biz step end*/

/*查找框函数*/
/*find qry fun begin*/

/*find qry fun end*/

/*页面结束*/
function A40E3F_page_end(){
	A40E3F_adjust_tab();
}

//按钮弹窗
window.A40E3F_Upd_EvaEvents = {'click #A40E3F_btn_Upd': function (e, value, row, index) {
		A40E3F_prev_btn = "";
		A40E3F_btn = "A40E3F_btn_t_department_edit";
		A40E3F_select_t_department_rowId = index.toString();
		//$("#A40E3F_btn_t_department_edit").click();//此处不需要执行，在table row行click中执行
	}
	,'click #A40E3F_btn_Del': function (e, value, row, index){
		A40E3F_prev_btn = "";
		A40E3F_btn = "A40E3F_btn_t_department_delete";
		A40E3F_select_t_department_rowId = index.toString();
		//$("#A40E3F_btn_t_department_delete").click();//此处不需要执行，在table row行click中执行
	}
	//按钮事件
	/*table button events begin*/

	/*table button events end*/
};

//按钮定义
function A40E3F_Upd_EvaFormatter(value, row, index) {
	var btnHtml = "<div style=\"display: block;\">"
	btnHtml += "<button id=\"A40E3F_btn_Upd\" class=\"btn btn-warning btn-edit\" ><strong><i class=\"fa fa-edit\"></i>修改</strong></button>";
	btnHtml += "&nbsp;<button id=\"A40E3F_btn_Del\" class=\"btn btn-danger btn-del\" ><strong><i class=\"fa fa-remove\"></i>删除</strong></button>";
	/*table button defined begin*/

	/*table button defined end*/
	btnHtml += "</div>";
	return [btnHtml].join();
}

//部门显示列定义
var A40E3F_t_department = [
	{ 
		checkbox:true
	},
	/*table column begin*/
    {
        title: '主键',
        field: 'MAIN_ID',
        sortable: true,
        visible: false,
        width: 60
    },
    {
        title: '上级部门ID',
        field: 'P_ID',
        sortable: true
    }
    ,{
        title: '上级部门ID名称',
        field: 'P_ID_cn_name',
        sortable: true
       ,formatter: set_s_decode
    },
    {
        title: '部门名称',
        field: 'DEPT_NAME',
        sortable: true
        ,formatter: set_s_decode
    },
    {
        title: '排序',
        field: 'S_SORT',
        sortable: true
    },
    {
        title: '是否启用',
        field: 'S_STATE',
        sortable: true
        ,formatter: A40E3F_format_S_STATE
    },
    {
        title: '系统时间',
        field: 'CREATE_DATE',
        sortable: true
        ,formatter: set_time_decode
    },
    {
        title: '备注',
        field: 'S_DESC',
        sortable: true
        ,formatter: set_s_decode
    }
	
	/*table column end*/
	,{
        title: '操作',
        class: 'tb_columns',
        events: A40E3F_Upd_EvaEvents,
        formatter: A40E3F_Upd_EvaFormatter
    }
];

//页面初始化
function A40E3F_init_t_department() {
	$(window).resize(function () {
		  $('#A40E3F_t_department_Events').bootstrapTable('resetView');
	});
	//部门查询条件初始化设置
	/*query conditions init begin*/
	
    /*query conditions init end*/
	
	$('#A40E3F_btn_t_department_query').click();
}

//查询接口
function A40E3F_t_department_query() {
    $('#A40E3F_t_department_Events').bootstrapTable("removeAll");
	//以下为特殊字段列表查询，无特殊字段时不需要
	var inputdata = {
		"param_name": "N01_sel_t_department_ByNodeID",
		"session_id": session_id,
		"login_id": login_id
		/*传递查询条件变量*/
        /*get query param begin*/
		,"param_value1": A40E3F_tem_TreeNode		
        /*get query param end*/
	};
	ly_index = layer.load();
	get_ajax_baseurl(inputdata, "A40E3F_get_N01_sel_t_department_ByNodeID");
}

//树形结构函数定义
/*tree function defined begin*/
function A40E3F_Bind_Tree(inputValue){
	//设置父节点名称
    var temPID = {};
	//父节点id和名称
	for (var key in A40E3F_select_TreeNode){
		var temNodeParents = $('#A40E3F_t_department_tree').treeview("getParents",A40E3F_select_TreeNode[key]);
		if(temNodeParents.length > 0){
			temPID[temNodeParents[0].main_id] = temNodeParents[0].text;
			break;
		}
	}
    $.each(inputValue, function (i, obj){
    	inputValue[i]["P_ID_cn_name"] = "";
		if(temPID.hasOwnProperty(obj.P_ID)){
			inputValue[i]["P_ID_cn_name"] = temPID[obj.P_ID];
		}
		else{
			for(var n = 0; n < i; n ++){
				if(inputValue[n].MAIN_ID.toString() == obj.P_ID.toString()){
					inputValue[i]["P_ID_cn_name"] = inputValue[n].TEXT.toString();
					temPID[obj.P_ID] = inputValue[n].TEXT.toString();
					break;
				}
			}
		}
    });
	//树形控件结果绑定
	if(A40E3F_tem_TreeNode.toString() == "0" || A40E3F_tem_TreeNode.toString() == ""){
		var tree_data = formatTree(inputValue);
	    //初始化树控件
		$('#A40E3F_t_department_tree').treeview({data: []});
	 	$('#A40E3F_t_department_tree').treeview({
	 		data: formatSubTree(tree_data,"main_id","p_id"),
	 		levels: 1,
	 		onNodeSelected:function(event, node){
				A40E3F_select_TreeNode = {};
				A40E3F_select_TreeNode[node.main_id] = node;
				$('#A40E3F_btn_t_department_query').click();
	 		},
	 		onNodeUnselected: function (event, node) {
				A40E3F_select_TreeNode = {};
	 		},
	 		onNodeChecked: function (event, node) {
				A40E3F_select_TreeNode[node.main_id] = node;
	 		},
	 		onNodeUnchecked: function (event, node) {
				delete A40E3F_select_TreeNode[node.main_id];
	 		},
			showCheckbox:true,//是否显示多选
			hierarchicalCheck:true
		});
	 	$('#A40E3F_t_department_tree').treeview("expandAll");
    }
	return inputValue;
}
/*tree function defined end*/

//查询结果
function A40E3F_get_N01_sel_t_department_ByNodeID(input) {
	layer.close(ly_index);
	//查询失败
    if (Call_QryResult(input.N01_sel_t_department_ByNodeID) == false)
        return false;
    //树形结构函数调用
    /*tree function run begin*/

	input.N01_sel_t_department_ByNodeID = A40E3F_Bind_Tree(input.N01_sel_t_department_ByNodeID);
    /*tree function run end*/    
    A40E3F_rowCheckData = null;
    //调整table各列宽度
    $.each(A40E3F_t_department, function (i, obj) {
		if(obj.title != undefined && (obj.visible == undefined || obj.visible == true)){
			obj.width = obj.title.length * 14 + 37;
		}
		//操作列宽度定义
		if(i == A40E3F_t_department.length - 1){
			obj.width = "200";
		}
	});
	
	var s_data = input.N01_sel_t_department_ByNodeID;
    A40E3F_select_t_department_rowId = "";
    if(s_data.length > 0){
    	A40E3F_rowCheckData = s_data[0]; 
    }
    //table对应的属性
    var temTableAtt = {};
    if(A40E3F_table_page == 1){
    	temTableAtt["url"] = bizzUrl;
    	temTableAtt["method"] = "get";
    	temTableAtt["sidePagination"] = "server";
    	temTableAtt["queryParamsType"] = "limit";
    }
    else{
    	temTableAtt["url"] = null;
    	temTableAtt["method"] = null;
    	temTableAtt["sidePagination"] = null;
    	temTableAtt["queryParamsType"] = null;
    }
    $('#A40E3F_t_department_Events').bootstrapTable('destroy');
    $("#A40E3F_t_department_Events").bootstrapTable({
        uniqueId: 'main_id',
        search: !0,
        pagination: !0,
        showRefresh: !0,
        showToggle: !0,
        locale: "zh-CN",
        showColumns: !0,
        showExport: !0,
        exportDataType:"all",
        exportTypes:['excel'],
        iconSize: "outline",
        onClickRow: function (row, $element) {
            // 判断是否已选中
            if (A40E3F_prev_btn == A40E3F_btn && $($element).hasClass("changeColor")) {
                $('#A40E3F_t_department_Events').find("tr.changeColor").removeClass('changeColor');
                A40E3F_select_t_department_rowId = "";
            }
            else {
                // 未点击则，为当前行添加 class='changeColor'
                $('#A40E3F_t_department_Events').find("tr.changeColor").removeClass('changeColor');
                $($element).addClass('changeColor');                　
                A40E3F_select_t_department_rowId = $element.attr('data-index');
                
                //设置子表查询条件
                /*set child table qry begin*/
                
                $($("#A40E3F_TAB_MAIN").find(".active")[0]).click();
                /*set child table qry end*/
                //判断是否button按钮点击事件
        		if(typeof($("#A40E3F_TAB_MAIN").find(".active")[0]) == "undefined" && A40E3F_prev_btn != A40E3F_btn){
        			A40E3F_prev_btn = A40E3F_btn;
        			if($("#"+A40E3F_btn)[0] == undefined)
        				eval(A40E3F_btn + "()");
        			else
        				$("#"+A40E3F_btn).click();
        		}
            }
        },
		onDblClickRow: function (row){
			if(A40E3F_param.hasOwnProperty("target_name"))
			{
				$("#"+A40E3F_param["target_id"]).val(eval("row."+A40E3F_param["sourc_id"].toUpperCase()));
				$("#"+A40E3F_param["target_name"]).val(s_decode(eval("row."+A40E3F_param["sourc_name"].toUpperCase())));				
				layer.close(A40E3F_param["ly_index"]);
			}
		},
        toolbar: "#A40E3F_t_department_Toolbar",
        url: temTableAtt["url"],
        method: temTableAtt["method"],
        height:500,
        columns: A40E3F_t_department,
        data: s_data,
        pageNumber: 1,
        pageSize: 10, // 每页的记录行数（*）
        pageList: [10,50,100,1000,2000], // 可供选择的每页的行数（*）
        queryParams: A40E3F_t_department_queryParams,
        sidePagination: temTableAtt["sidePagination"],//"server", //服务端处理分页
	    queryParamsType : temTableAtt["queryParamsType"],//"limit",//设置为 ‘limit’ 则会发送符合 RESTFul 格式的参数.
        icons: {
            refresh: "glyphicon-repeat",
            toggle: "glyphicon-list-alt",
            columns: "glyphicon-list"
        },
        onPostBody:function(){
        },
        onLoadSuccess: function(input){
        	if(input.rows.length > 0)
        		A40E3F_rowCheckData = input.rows[0]; 
        },
        onLoadError: function(err){
            console.log("error: "+err);
        },
        responseHandler:A40E3F_Res_N01_sel_t_department
    });
	A40E3F_page_end();
}

//设置参数
function A40E3F_t_department_queryParams(inputdata){
	ly_index = layer.load();
	if(A40E3F_table_page == 0)
		return null;
	var temdata = {
		"param_name": "N01_sel_t_department_ByNodeID",
		"session_id": session_id,
		"login_id": login_id
		/*传递查询条件变量*/
        /*get query param begin*/
		,"param_value1": A40E3F_tem_TreeNode
        /*get query param end*/
	};	
	for (var key in temdata) {
		inputdata[key] = temdata[key];
    }
	if(inputdata.hasOwnProperty("offset") && inputdata.hasOwnProperty("limit")){
		inputdata["pageNumber"] = parseInt(inputdata["offset"] / inputdata["limit"]) + 1;
		inputdata["pageSize"] = inputdata["limit"];
	}
	else{
		inputdata["pageNumber"] = 0;
		inputdata["pageSize"] = 0;
	}
	return inputdata;
}

//获取接口数据
function A40E3F_Res_N01_sel_t_department(input){
	layer.close(ly_index);
	//查询失败
    if (Call_QryResult(input.N01_sel_t_department_ByNodeID) == false)
        return false;
    if(input["N01_sel_t_department_ByNodeID"].length > 0)
    	A40E3F_rowCheckData = input["N01_sel_t_department_ByNodeID"][0];
    if(A40E3F_table_page == 0)
		return null;
	else{ 
		var json_list = {};
		json_list["total"] = input["N01_sel_t_department_ByNodeID_ROWS"];
		json_list["rows"] = input["N01_sel_t_department_ByNodeID"];
		return json_list;
	}
}

//刷新按钮
$('#A40E3F_btn_t_department_refresh').click(function () {
	/*重置查询条件变量*/
	/*refresh query param begin*/
   A40E3F_select_TreeNode = {};
   A40E3F_tem_TreeNode = 0;

	/*refresh query param end*/

	/*重置下拉框集合定义*/
	/*refresh select options begin*/

	/*refresh select options end*/
	A40E3F_param_set();
	/*页面重置重新加载*/
	/*biz begin*/
    $.each(A40E3F_ary_S_STATE, function (i, obj) {
        addOptionValue("A40E3F_qry_S_STATE", obj[GetLowUpp("main_id")], s_decode(obj[GetLowUpp("cn_name")]));
    });
    A40E3F_init_t_department()
	
    /*biz end*/
})

//查询按钮
$('#A40E3F_btn_t_department_query').click(function () {
	/*设置查询条件变量*/
    /*set query param begin*/
	if($.isEmptyObject(A40E3F_select_TreeNode)){
		A40E3F_tem_TreeNode = 0;
	}
	else{
		//父节点id和名称
		for (var key in A40E3F_select_TreeNode){
			A40E3F_tem_TreeNode = A40E3F_select_TreeNode[key].main_id;
			break;
		}
	}
	
    /*set query param end*/
	A40E3F_t_department_query();
})

//vue回调
function A40E3F_t_department_call_vue(objResult){
	//选择某条记录或自动选择第一条
	if (A40E3F_select_t_department_rowId != "") 
		A40E3F_rowCheckData = $("#A40E3F_t_department_Events").bootstrapTable('getData')[A40E3F_select_t_department_rowId];
	
	if(index_subhtml == "t_department_$.vue")
	{
		var n = Get_RandomDiv("B40E3F",objResult);	
		layer.open({
			type: 1,
	        area: ['1100px', '600px'],
	        fixed: false, //不固定
	        maxmin: true,
	        content: $(n),
	        success: function(layero, index){
	        	A40E3F_toparam = {};
	        	A40E3F_toparam["type"] = A40E3F_type;
	        	A40E3F_toparam["ly_index"] = index;
				if(A40E3F_param.hasOwnProperty("hidden_find")){
					A40E3F_toparam["hidden_find"] = "1";
				}			
				/*查询条件参数传递至子页面,初次加载*/
				/*Send One FindSelect param bgein*/
				if($.isEmptyObject(A40E3F_select_TreeNode)){
					A40E3F_toparam["P_ID"] = "0";
					A40E3F_toparam["P_ID_cn_name"] = "";
				}
				else{
					//父节点id和名称
					for (var key in A40E3F_select_TreeNode){
						A40E3F_toparam["P_ID"] = A40E3F_select_TreeNode[key].main_id;
						A40E3F_toparam["P_ID_cn_name"] = A40E3F_select_TreeNode[key].text;
					}
				}
					
				/*Send One FindSelect param end*/
				
	        	loadScript_hasparam("sys_vue/t_department_$.js","B40E3F_t_department_biz_start",A40E3F_toparam);
	        },
			end: function(){
				$(n).hide();
			}
	    });
	}
	/*查询条件弹窗子页面*/
    /*get find subvue bgein*/
	
	/*get find subvue end*/
	
	/*tab页显示子页面*/
	/*get tab subvue begin*/

	/*get tab subvue end*/
	
	//判断是否button按钮点击事件
	if(A40E3F_prev_btn != A40E3F_btn){
		A40E3F_prev_btn = A40E3F_btn;
		if($("#"+A40E3F_btn)[0] == undefined)
			eval(A40E3F_btn + "()");
		else
			$("#"+A40E3F_btn).click();
	}
}

//新增按钮
$("#A40E3F_btn_t_department_add").click(function () {
	A40E3F_type = "add";
	index_subhtml = "t_department_$.vue";
	if(loadHtmlSubVueFun("sys_vue/t_department_$.vue","A40E3F_t_department_call_vue") == true){
		var n = Get_RandomDiv("B40E3F","");
		layer.open({
			type: 1,
			area: ['1100px', '600px'],
			fixed: false, //不固定
			maxmin: true,
			content: $(n),
			success: function(layero, index){
				B40E3F_param = {};
				B40E3F_param["type"] = A40E3F_type;
				B40E3F_param["ly_index"]= index;
				if(A40E3F_param.hasOwnProperty("hidden_find")){
					B40E3F_param["hidden_find"] = "1";
				}
				/*查询条件参数传递至子页面,再次加载*/
			    /*Send Two FindSelect param bgein*/
                if($.isEmptyObject(A40E3F_select_TreeNode)){
                    B40E3F_param["P_ID"] = "0";
                    B40E3F_param["P_ID_cn_name"] = "";
                }
                else{
                	//父节点id和名称
                	for (var key in A40E3F_select_TreeNode){
                		B40E3F_param["P_ID"] = A40E3F_select_TreeNode[key].main_id;
                		B40E3F_param["P_ID_cn_name"] = A40E3F_select_TreeNode[key].text;
                	}
                }
				
				/*Send Two FindSelect param end*/

				B40E3F_clear_edit_info();
			},
			end: function(){
				B40E3F_clear_validate();
				$(n).hide();
			}
		});
	}
})

//编辑按钮
$("#A40E3F_btn_t_department_edit").click(function () {
	if (A40E3F_select_t_department_rowId != "") {
		A40E3F_type = "edit";
		index_subhtml = "t_department_$.vue";
		if(loadHtmlSubVueFun("sys_vue/t_department_$.vue","A40E3F_t_department_call_vue") == true){
			var n = Get_RandomDiv("B40E3F","");
			layer.open({
				type: 1,
				area: ['1100px', '600px'],
				fixed: false, //不固定
				maxmin: true,
				content: $(n),
				success: function(layero, index){
					B40E3F_param = {};
					B40E3F_param["type"] = A40E3F_type;
					B40E3F_param["ly_index"] = index;
					if(A40E3F_param.hasOwnProperty("hidden_find")){
						B40E3F_param["hidden_find"] = "1";
					}
					B40E3F_clear_edit_info();
					//B40E3F_get_edit_info();
				},
				end: function(){
					B40E3F_clear_validate();
					$(n).hide();
				}
			});
		}
	} else {
		swal({
            title: "提示信息",
            text: "无法修改记录，请选择正确记录修改!"
        });
    }
})

//删除按钮
$('#A40E3F_btn_t_department_delete').click(function () {
	//单行选择
	var rowData = $("#A40E3F_t_department_Events").bootstrapTable('getData')[A40E3F_select_t_department_rowId];
	//多行选择
	var rowDatas = A40E3F_sel_row_t_department();
	if (A40E3F_select_t_department_rowId != "" || rowDatas.length > 0) {
    	swal({
            title: "告警",
            text: "确认要删除吗?删除数据将无法恢复!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "确定",
            closeOnConfirm: false
        },
		function () {
        	if(rowDatas.length > 0)
        	{
	        	$.each(rowDatas, function (i, obj) {
					var delete_main_id = obj.MAIN_ID;
					var inputdata = {
						"param_name": "N01_del_t_department",
						"session_id": session_id,
						"login_id": login_id,
						"param_value1": delete_main_id
					};
					ly_index = layer.load();
					get_ajax_baseurl(inputdata, "A40E3F_N01_del_t_department");
	        	});
        	}
        	else
        	{
        		var delete_main_id = rowData["MAIN_ID"];
				var inputdata = {
					"param_name": "N01_del_t_department",
					"session_id": session_id,
					"login_id": login_id,
					"param_value1": delete_main_id
				};
				ly_index = layer.load();
				get_ajax_baseurl(inputdata, "A40E3F_N01_del_t_department");
        	}
		}); 
    } else {
    	swal({
            title: "提示信息",
            text: "无法删除记录，请选择正确记录删除!"
        });
    }
})

//删除结果
function A40E3F_N01_del_t_department(input) {
	layer.close(ly_index);
	if(Call_OpeResult(input.N01_del_t_department) == true)
		A40E3F_t_department_query();
}

//弹窗1
function A40E3F_open_to_url1(temindex_subhtml,temrandom_subhtml,temparam){
	A40E3F_btn = "";
	A40E3F_prev_btn = "";
	index_subhtml = s_decode(temindex_subhtml);
	inputrandom = s_decode(temrandom_subhtml);
	//本页面传到其他页面参数
	A40E3F_toparam = JSON.parse(s_decode(temparam));
	if(loadHtmlSubVueFun(index_subhtml,"A40E3F_t_department_call_vue") == true){
		var n = Get_RandomDiv(inputrandom,"");
		layer.open({
			type: 1,
			area: ['1100px', '600px'],
			fixed: false, //不固定
			maxmin: true,
			content: $(n),
			success: function(layero, index){
				A40E3F_toparam["ly_index"] = index;
				eval(inputrandom+"_param = {}");
				for(var key in A40E3F_toparam)
					eval(inputrandom+"_param['"+key+"'] = '"+A40E3F_toparam[key]+"'");
				//参数传递并赋值
				eval(inputrandom+"_param_set()");
				var tbName = "";
				if(index_subhtml.indexOf("/") == -1)
					tbName = index_subhtml.substring(0,index_subhtml.indexOf(".vue"));
				else
					tbName = index_subhtml.substring(index_subhtml.lastIndexOf("/")+1,index_subhtml.indexOf(".vue"));
				eval(inputrandom+"_init_"+tbName+"()");
			},
			end: function(){
				$(n).hide();
			}
		});	
	}
}

//2:系统内tab页
function A40E3F_open_to_url2(temindex_subhtml,temrandom_subhtml,temparam){
	A40E3F_btn = "";
	A40E3F_prev_btn = "";
	index_subhtml = s_decode(temindex_subhtml);
	inputrandom = s_decode(temrandom_subhtml);
	//调用或加载左侧菜单并click
	Add_No_Show_Menu(index_subhtml,inputrandom,JSON.parse(s_decode(temparam)));	
}

//3：浏览器tab页
function A40E3F_open_to_url3(temindex_subhtml,temrandom_subhtml,temparam){
	A40E3F_btn = "";
	A40E3F_prev_btn = "";
	index_subhtml = s_decode(temindex_subhtml);
	inputrandom = s_decode(temrandom_subhtml);
}

//按钮事件触发页面跳转，1:弹窗、2:系统内tab页、3：浏览器tab页
/*open new page begin*/

/*open new page end*/

//打开新页面
function A40E3F_open_url(objTag,iIndex){
	//弹窗
	if(iIndex == 0)
		A40E3F_open_to_url1($(objTag).attr("param1"),$(objTag).attr("param2"),$(objTag).attr("param3"));
	//系统内tab页
	else if(iIndex == 1)
		A40E3F_open_to_url2($(objTag).attr("param1"),$(objTag).attr("param2"),$(objTag).attr("param3"));
	//浏览器tab页
	else if(iIndex == 2)
		A40E3F_open_to_url3($(objTag).attr("param1"),$(objTag).attr("param2"),$(objTag).attr("param3"));
}

//主从表选项卡动态添加
function A40E3F_adjust_tab(){
	if(typeof($("#A40E3F_TAB_MAIN")[0]) != "undefined" && $("#A40E3F_TAB_MAIN")[0].length != 0){
		A40E3F_Tab_Flag = 1;
		$(Get_RDivNoBuild("A40E3F","")).find(".wrapper-content").css("padding","20px 20px 0px 20px");
		$(Get_RDivNoBuild("A40E3F","")).find(".ibox").css("margin-bottom","0px");
		$(Get_RDivNoBuild("A40E3F","")).find(".ibox-content").css("padding","15px 20px 0px");		
		$($("#A40E3F_TAB_MAIN").find(".active")[0]).click();
	}
}

/*tab选项卡按钮点击事件*/
/*Tab Click Fun Begin*/
//隐藏tab页选项卡
function A40E3F_hide_tab_fun(){
    var n = null;
}

//判断是否sub子项div页面
function A40E3F_Is_Sub_Div(temDivId){
    if(temDivId.indexOf("XX$TTT") == 0)
        return false;
    return false;
}


/*Tab Click Fun End*/

function A40E3F_show_tab_fun(inputUrl,inputrandom,temPar){
	index_subhtml = inputUrl;
	random_subhtml = inputrandom;
	if(loadHtmlSubVueFun("sys_vue/"+inputUrl,"A40E3F_t_department_call_vue") == true){
		var n = Get_RandomDiv(inputrandom,"");
		$(n).show();
		var rowData = null;
		//选择某条记录或自动选择第一条并传递参数
		if (A40E3F_select_t_department_rowId != "") 
			rowData = $("#A40E3F_t_department_Events").bootstrapTable('getData')[A40E3F_select_t_department_rowId];
		else
			rowData = A40E3F_rowCheckData;
		//$("#A40E3F_t_department_Events").bootstrapTable('getData')[0];
		eval(inputrandom+"_param = {}");
		if(rowData != null){
			var temFlag = true;
			$.each(temPar, function (i, obj) {
				if(eval(inputrandom+"_param.hasOwnProperty(\""+obj.target_id+"\")") && eval(inputrandom+"_param[\""+obj.target_id+"\"]").toString() == rowData[obj.sourc_id].toString())
					temFlag = false;
				else
					eval(inputrandom+"_param[\""+obj.target_id+"\"] = \""+rowData[obj.sourc_id]+"\"");
			});
			if(temFlag){
				//传递子页面隐藏find功能
				eval(inputrandom+"_param[\"hidden_find\"] = \"1\"");
				//参数传递并赋值
				eval(inputrandom+"_param_set()");
				var tbName = inputUrl.substring(0,inputUrl.indexOf(".vue"));		
				eval(inputrandom+"_"+tbName+"_biz_start("+inputrandom+"_param)");
			}
		}
		else{
			$.each(temPar, function (i, obj) {
				if(obj.sourc_id.toUpperCase() == "MAIN_ID")
					eval(inputrandom+"_param[\""+obj.target_id+"\"] = \"-999\"");
				else
					eval(inputrandom+"_param[\""+obj.target_id+"\"] = \"\"");
				return;
			});
			//传递子页面隐藏find功能
			eval(inputrandom+"_param[\"hidden_find\"] = \"1\"");
			//参数传递并赋值
			eval(inputrandom+"_param_set()");
			var tbName = inputUrl.substring(0,inputUrl.indexOf(".vue"));		
				eval(inputrandom+"_"+tbName+"_biz_start("+inputrandom+"_param)");
		}
	}
	//判断是否button按钮点击事件
	if(A40E3F_prev_btn != A40E3F_btn){
		A40E3F_prev_btn = A40E3F_btn;
		$("#"+A40E3F_btn).click();
	}
}

//清除 查找框
function A40E3F_clear_input_cn_name(obj1,obj2){
	$("#"+obj1).val("");
	$("#"+obj2).val("-1");
}

//选择多行数据进行业务操作
function A40E3F_sel_row_t_department(){
	//获得选中行
	var checkedbox= $("#A40E3F_t_department_Events").bootstrapTable('getSelections'); 
	//将选中行数据转成jsonStr
	var jsonStr=JSON.stringify(checkedbox);
	//将jsonStr转成jsonObject对象	 
	var jsonObject=jQuery.parseJSON(jsonStr);
	return jsonObject;
	//接着就可以遍历jsonObject数组对象，取出并操作数据
	//alert(jsonObject);
}
